/// YApi QuickType插件生成，具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation

import 'dart:convert';

ImMsgContentDomain imMsgContentDomainFromJson(String str) =>
    ImMsgContentDomain.fromJson(json.decode(str));

String imMsgContentDomainToJson(ImMsgContentDomain data) =>
    json.encode(data.toJson());

class ImMsgContentDomain {
  ImMsgContentDomain({
    required this.loginUser,
    this.gName,
    this.gid,
    required this.msgType,
    required this.sendId,
    required this.sendName,
    this.playTimer,
    this.thumbUrl,
    required this.receiveUType,
    this.remark,
    this.type,
    required this.content,
    this.url,
    required this.receiveId,
    required this.receiveName,
    this.from,
    required this.sendUType,
    required this.time,
    this.fileLength,
  });

  static const int TEXT_MSG_TYPE = 1103;
  static const int IMAGE_MSG_TYPE = 1104;
  static const int VIDEO_MSG_TYPE = 1105;
  static const int LOCATION_MSG_TYPE = 1302;
  static const int VOICE_MSG_TYPE = 1106;

  String loginUser;
  String? gName;
  String? gid;
  int msgType;
  String sendId;
  String sendName;
  int? playTimer;
  int receiveUType;
  String? remark;
  String? thumbUrl;
  int? type;
  String content;
  String? url;
  String receiveId;
  String receiveName;
  String? from;
  int sendUType;
  int time;
  int? fileLength;

  factory ImMsgContentDomain.fromJson(Map<dynamic, dynamic> json) =>
      ImMsgContentDomain(
        loginUser: json["loginUser"],
        gName: json["gName"],
        gid: json["gid"],
        msgType: json["msgType"],
        sendId: json["sendId"],
        sendName: json["sendName"],
        playTimer: json["playTimer"],
        receiveUType: json["receiveUType"],
        remark: json["remark"],
        thumbUrl: json["thumbUrl"],
        type: json["type"],
        content: json["content"],
        url: json["url"],
        receiveId: json["receiveId"],
        receiveName: json["receiveName"],
        from: json["from"],
        sendUType: json["sendUType"],
        time: json["time"],
        fileLength: json["fileLength"],
      );

  Map<dynamic, dynamic> toJson() => {
    "loginUser": loginUser,
    "gName": gName,
    "gid": gid,
    "msgType": msgType,
    "sendId": sendId,
    "sendName": sendName,
    "playTimer": playTimer,
    "receiveUType": receiveUType,
    "remark": remark,
    "type": type,
    "content": content,
    "url": url,
    "receiveId": receiveId,
    "receiveName": receiveName,
    "from": from,
    "thumbUrl": thumbUrl,
    "sendUType": sendUType,
    "time": time,
    "fileLength": fileLength,
  };

  static String tableName = "im_msg_content";

  //建表语句
  static String createTableSql = '''
      CREATE TABLE If NOT EXISTS $tableName  (
        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 
        loginUser   TEXT,
        gName    TEXT ,
        gid  TEXT,
        msgType   INTEGER,
        sendId   TEXT,
        sendName   TEXT,
        playTimer   INTEGER,
        receiveUType   INTEGER,
        remark   TEXT,
        type   INTEGER,
        content   TEXT,
        url   TEXT,
        thumbUrl   TEXT,
        receiveId   TEXT,
        receiveName   TEXT,
        `from`   TEXT,
        sendUType   INTEGER,
        time   INTEGER,
       fileLength   INTEGER
      );
      ''';
}
